package com.example.entity.dto;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Date;

@Data
@AllArgsConstructor
public class InteractDto {
    Integer tid;
    Integer uid;
    Date time;
    String type;

    public String toKey() {
        return tid + ":" + uid;
    }

    //将redis中的key串构造一个interactDto对象
    public static InteractDto parseInteract(String str, String type){
        String[] keys = str.split(":");
        return new InteractDto(Integer.parseInt(keys[0]), Integer.parseInt(keys[1]), new Date(), type);
    }
}
